import axios from 'axios'
import config from '../../index'
console.log(config)
// console.log(process.env)
// export function loginRequest () {
//         console.log('LOGIN请求')
//         axios.get('/banners').then(res => { console.log(res) })
//     }
axios.defaults.baseURL = config.baseUrl
axios.defaults.timeout = 10000
// axios.defaults.headers.common['Authorization'] = 'Bearer 18375f13-cfab-4fb1-b485-54959cca2ab3'
axios.defaults.headers.post['Content-Type'] = 'application/json'
// 请求拦截
axios.interceptors.request.use(function(config) {
  return config
}, function(error) {
  console.log('请求出错因为超时')
  return Promise.reject(error)
})
// 响应拦截器
axios.interceptors.response.use(function(response) {
  return response
}, function(error) {
  console.log('请求出错因为超时')
  return Promise.reject(error)
})
const instance = axios.create()

export default instance

